package org.dromara.system.controller.api;

import lombok.RequiredArgsConstructor;
import org.dromara.common.core.domain.R;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.system.api.domain.vo.RemoteClientVo;
import org.dromara.system.domain.vo.SysClientVo;
import org.dromara.system.service.ISysClientService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: zhou shuai
 * @date: 2024/9/26 20:31
 * @version: v1
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/system/client")
public class SysClientApiController {

    private final ISysClientService sysClientService;

    /**
     * 根据客户端id获取客户端详情
     */
    @GetMapping("/{clientId}")
    public R<RemoteClientVo> queryByClientId(@PathVariable("clientId") String clientId) {
        SysClientVo vo = sysClientService.queryByClientId(clientId);
        return R.ok(MapstructUtils.convert(vo, RemoteClientVo.class));
    }

}
